﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LeMigue.Scrum.Iterface.Model;
using LeMigue.Scrum.Iterface.Enum;

namespace LeMigue.TeamPortal.Base.View
{
    public class MemberView
    {
        protected IMember _membro;

        public MemberView(IMember membro)
        {
            _membro = membro;
        }

        public string Name
        {
            get { return _membro.Name; }
        }

        public string Tipo
        {
            get
            {
                if (_membro.Tipo == MemberType.Group)
                    return "grupo";

                if (_membro.Tipo == MemberType.User)
                    return "user";

                return "";
            }
        }

        public IList<MemberView> Membros
        {
            get
            {
                if (_membro.Tipo == MemberType.User)
                    return new List<MemberView>();

                return ((Group)_membro).Membros.Select(m => new MemberView(m)).ToList();
            }
        }
        
    }
}
